package com.amit.jdbc.mysql;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;

public class Lab4_JLC {

	public static void main(String[] args) throws Exception {
		
	//1.load the driver class
		Class.forName("com.mysql.jdbc.Driver");
		Class.forName("oracle.jdbc.driver.OracleDriver");
		
	//2.create the connection 
		
		Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/jdbcdb","root","root");
	//Connection	con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","amit");
		
    //3.prepare the sql query
		
		String sql="insert into jlcstudents values(4,'ajeet','ajeet@gmail.com',7259745608)";
	
    //4.prepare the jdbc statement
		
		Statement st=con.createStatement();
		
	//5.submit the jdbc statement
		
		int i=st.executeUpdate(sql);
		
	//6.process the result
		
		if(i==1)
		{
			System.out.println("record inseted");
			
		}
		else
		{
			System.out.println("record not inserted");
		}
		
		//7.close the connection
		
		con.close()
		;

	}

}
